# -*- coding: utf8 -*-
from pyramid_layout.layout import layout_config
from .views import (
         to_euro,
         to_euroz,
         to_percent,
         )
from pyramid.security import authenticated_userid


@layout_config(template='monaem:templates/layouts/global_layout.pt')
class GlobalLayout(object):
    page_title = u"Mon espace MARIETTON"

    def __init__(self, context, request):
        self.context = context
        self.request = request
        self.home_url = request.application_url

    def to_euro(self, x):
        return to_euro(x)

    def to_euroz(self, x):
        return to_euroz(x)

    def to_percent(self, x):
        return to_percent(x)

    def get_nextPayment(self, dossier):
        return get_nextPayment(dossier)

    def isAnonymous(self):
        user = authenticated_userid(self.request)
        return user is None
